﻿using System.Collections.Generic;
using System.Linq;
using CooliteExample.Model;
using CooliteExamples.Code.DTO;

namespace CooliteExamples.Code.DAL
{
    public static class CategoryDAL
    {
        public static List<Category> GetAllCategories()
        {
            using (BookManagerEntities context = new BookManagerEntities())
            {
                return context.CategorySet.OrderBy(c => c.Name).ToList().Select(c => new Category(c)).ToList();
            }
        }
    }
}
